package com.itheima.day05;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;

public class Demo3 {
    public static void main(String[] args) {
       List<String> list = new ArrayList<>();
        list.add("枸杞");
        list.add("Java入门");
        list.add("宁夏枸杞");
        list.add("黑枸杞");
        list.add("人字拖");
        list.add("特级枸杞");
        list.add("枸杞子");
        System.out.println(list);

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            if (next.contains("枸杞")) {
                iterator.remove();
            }
        }
        System.out.println(list);

        for (String s : list) {

        }
        list.forEach(s -> System.out.println("s = " + s));
    }
}
